//
//  ST_BTGCBaseUserModel.swift
//  btvideo
//
//  Created by mac on 2020/8/6.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SwiftyUserDefaults
import HandyJSON

/**
 统计基础属性
 */
class ST_BTGCBaseUserModel: NSObject{
    /**
     用户当前accid
     */
    var user_id:String{
        return Defaults[.currentUserID]
    }
    /**
     年龄
     */
    var user_age:Int{
        if let age = ST_BTUserInfoManager.shared.current_account_info?.userinfo?.age{
            return age
        }
        return 0
    }
    /**
     性别 ex: 男/女
     */
    var user_gender:String{
        if let sex = ST_BTUserInfoManager.shared.current_account_info?.userinfo?.sex{
            
            if sex == .male{
                return "男"
            }else if sex == .female{
                return "女"
            }
        }
        return ""
    }
    /**
     目的 ex: 认识新朋友/谈甜甜的恋爱/邂逅结婚对象/LGBT
     */
    var user_purpose:String{
        if let str = ST_BTUserInfoManager.shared.current_account_info?.userinfo?.personal_want_name{
            return str
        }
        return ""
    }
    /**
     认证状态 ex:真人头像/真人人脸/真人头像人脸
     */
    var certification_status:String{
            switch FACE_AVATAE_STATE {
            case 4:
                return "真人人脸"
            case 3:
                return "真人头像人脸"
            case 2:
                return "真人人脸"
            default:
                return "真人头像"
            }
    }
    /**
     注册年月日 ex:2020/8/4
     */
    var registration_date:String{
        if let dateStr = ST_BTUserInfoManager.shared.current_account_info?.userinfo?.register_time.double{
            
            return Date.init(unixTimestamp: dateStr).string(withFormat: "yyyy/MM/dd")
        }
        return ""
    }
    /**
     注册版本
     */
    var registration_version:String{
        if let str = ST_BTUserInfoManager.shared.current_account_info?.userinfo?.register_version{
            return str
        }
        return ""
    }
    
    
    func to_j_s_o_n()->[String:Any]?{
        
        return ["user_id":user_id,
                "user_age":user_age,
                "user_gender":user_gender,
                "user_purpose":user_purpose,
                "certification_status":certification_status,
                "registration_date":registration_date,
                "registration_version":registration_version]
    }
}
